<template>
	<view class="beijingse mainpadding">
		<view class="flexbetween">
			<view class="ffffff radius mainpadding wushi">
				<view class="huisetext textcenter">店铺营业额</view>
				<view class="heisetext textcenter margin_top">{{personinfo.shop_yy_price}}</view>
			</view>
			<view class="ffffff radius mainpadding wushi">
				<view class="huisetext textcenter">商品总数</view>
				<view class="heisetext textcenter margin_top">{{personinfo.shop_goods_num}}</view>
			</view>
		</view>
		<view class="zwtimg flexcenter" v-if="!list.data.length">
			<image src="../../static/image/system/zwt.png" mode=""></image>
		</view>
		<view class="ffffff mainpadding radius margin_top" v-if="list.data.length" v-for="item in list.data" :key="item.id" @click="tzspxq(item.id)">
			<view class="flexbetween xiahuax">
				<view class="shilitu">
					<image :src="item.image_text" mode=""></image>
				</view>
				<view class="" style="width: 74%;">
					<view class="ershib xiankuan">{{item.title}}</view>
					<view class="qianshu margin_top1">¥{{item.price}}</view>
				</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="sanshisan flexcenter">
					<view class="ershisi margin_right2">日</view>
					<view class="strongtext">{{item.totay_yy_price}}</view>
				</view>
				<view class="sanshisan flexcenter">
					<view class="ershisi margin_right2">月</view>
					<view class="strongtext">{{item.mouth_yy_price}}</view>
				</view>
				<view class="sanshisan flexcenter">
					<view class="ershisi margin_right2">年</view>
					<view class="strongtext">{{item.year_yy_price}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				shop_id:"",
				personinfo:{
					shop_yy_price:"",
					shop_goods_num:"",
				}
			}
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			getinfo() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.shop_id = res.data.shopapply.shop_id
						this.personinfo = res.data
						this.init()
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			// 热门推荐列表
			init(isPage, page) {
				let _this = this;
				httpRequest.request("/api/shop/goodsList", 'POST', {
					page: page || 1,
					limit: this.limit,
					hot_status: 1,
					shop_id: this.shop_id
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转商品详情
			tzspxq(id) {
				let obj = {
					goods_id: id
				}
				uni.navigateTo({
					url: '/pages/homepage/shangpinxq?msg=' + encodeURIComponent(JSON.stringify(obj))
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.ershisi {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.sanshisan:last-child {
		border: none;
	}

	.sanshisan {
		width: 33.33%;
		border-right: 1rpx solid #DADADA;
	}

	.shuliang {
		font-size: 26rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FAB536;
	}

	.qianshu {
		font-size: 30rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #FAB536;
	}

	.ershib {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.shilitu {
		width: 134rpx;
		height: 128rpx;
		border-radius: 14rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 14rpx;
		}
	}

	.xiahuax {
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid rgba(153, 153, 153, .1);
	}

	.heisetext {
		font-size: 34rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #000000;
	}

	.wushi {
		width: 40%;
	}

	.huisetext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}
</style>
